import {
	html2json,
	json2html
} from 'html2json'
	import {
		nanoid
	} from "nanoid"
	const md5 = require('js-md5')
export default{
	getJson() {
	let html = '<title title="按钮 Button">'
	html +='<u-button type="primary" text="确定"></u-button>'
	html +='<u-button type="primary" :plain="true" text="镂空"></u-button>'
	html +='<u-button type="primary" :plain="true" :hairline="true" text="细边"></u-button>'
	html +='<u-button type="primary" :disabled="disabled" text="禁用"></u-button>'
	html +='<u-button type="primary" loading loadingText="加载中"></u-button>'
	html +='<u-button type="primary" icon="map" text="图标按钮"></u-button>'
	html +='<u-button type="primary" shape="circle" text="按钮形状"></u-button>'
	html +='<u-button type="primary" size="small" text="大小尺寸"></u-button>'
    html += '</title>' 
	let json = html2json(html)
	console.log(json.child)
	json.child.map((fv, fk) => {
		if (typeof fv.child != 'undefined') {
			fv.child.map((sv, sk) => {
				sv.attr.compId = md5(JSON.stringify(sv))
				sv.h = 28
				sv.w = 100
				sv.isResize = true
				if (typeof sv.attr != 'undefined') {
					if (typeof sv.attr.size == 'undefined') {
						sv.attr.size = 'small'
					}
				}else{
					sv.attr = {size:'small'}
				}
			})
		}
	})
	return json.child
}
}
